package jk.fox.registry.zookeeper;

import jk.fox.config.registry.zookeeper.ZookeeperConfiguration;
import jk.fox.registry.Registry;
import jk.fox.registry.discovery.NodeDiscovery;
import jk.fox.registry.discovery.ZookeeperDiscovery;
import jk.fox.registry.register.NodeRegister;
import jk.fox.registry.register.ZookeeperRegister;

/**
 * @author cuichao
 * @Description: ZookeeperRegistry
 * @Date: create in 2020/6/2 16:29
 */
public class ZookeeperRegistry implements Registry {


    private ZookeeperConfiguration config;
    private ZookeeperClient client;

    public ZookeeperRegistry(ZookeeperConfiguration config) {
        this.config = config;
        this.client = new ZookeeperClient(config);
    }

    @Override
    public NodeDiscovery discovery() {
        return new ZookeeperDiscovery(config,client);
    }

    @Override
    public NodeRegister register() {
        return new ZookeeperRegister(config,client);
    }
}
